<template>
  <div class="workbench">
    <!-- 头部导航 -->
    <div class="iworkbench">
      <div class="iworkbench-left">
        <div><img :src="w_img" alt="" /></div>
      </div>
      <div class="iworkbench-right">
        <div class="iworkbench-right-left">
          <a href="javascript:void(0);" @click="$router.push('/')">
            <img :src="w_img_one" alt="" />
            <span>首页</span>
          </a>
        </div>
        <!-- 工作台头像 -->
        <el-popover placement="top-start" width="200" trigger="hover">
          <div slot="reference" class="iworkbench-right-right">
            <img :src="w_img_two" alt="" />
          </div>
          <div class="popover-top">
            <span><img :src="w_img_two" alt="" /></span>
            <span>{{ company }}</span>
          </div>
          <div
            class="popover-center"
            v-for="(p, index) in popover"
            :key="index"
            @click="pop(index)"
          >
            <span><img :src="p.img" alt="" /></span>
            <span @click="zhanghu(p.id)">{{ p.name }}</span>
          </div>
        </el-popover>

        <el-dialog
          class="account"
          title="账户设置"
          :visible.sync="dialogFormVisible"
        >
          <table class="zhanghu_table">
            <tr>
              <el-input
                placeholder="请输入登录密码"
                class="table_input"
                v-model="input"
                show-password
              ></el-input>
            </tr>
            <tr class="button_right">
              <el-button type="primary" @click="jinru()" class="buttons" plain
                >进入</el-button
              >
              <el-button type="primary" @click="dialogFormVisible = false" plain
                >取消</el-button
              >
            </tr>
          </table>
        </el-dialog>
        <!-- 账户设置详情 -->
        <el-dialog
          class="set_up"
          title="账户设置"
          :visible.sync="dialogFormVisibles"
          @close="closed()"
        >
          <table class="set_up_table">
            <tr>
              <td>账户手机号：</td>
              <td><el-input disabled v-model="ruleForm.phone"></el-input></td>
            </tr>
            <tr>
              <td>账户邮箱：</td>
              <td><el-input disabled v-model="ruleForm.email"></el-input></td>
            </tr>
            <tr>
              <td>账户密码：</td>
              <td><el-input v-model="poss" show-password></el-input></td>
            </tr>
            <tr>
              <td>单位名称：</td>
              <td><el-input v-model="ruleForm.company"></el-input></td>
            </tr>
            <tr>
              <td>信用代码：</td>
              <td><el-input v-model="ruleForm.credit"></el-input></td>
            </tr>
            <tr>
              <td>联系人名称：</td>
              <td><el-input v-model="ruleForm.name"></el-input></td>
            </tr>
            <tr>
              <td>
                <el-button
                  type="primary"
                  @click="baocun()"
                  style="
                    color: #fff;
                    background-color: #409eff;
                    border-color: #409eff;
                  "
                  >保存</el-button
                >
              </td>
              <td>
                <el-button
                  type="primary"
                  @click="dialogFormVisibles = false"
                  style="
                    color: #fff;
                    background-color: #409eff;
                    border-color: #409eff;
                  "
                  >取消</el-button
                >
              </td>
            </tr>
          </table>
        </el-dialog>
      </div>
    </div>
    <!-- 内容 -->
    <div class="beader">
      <div class="beader-left">
        <div class="beader-left-one">
          <img :src="b_img" alt="" />
          <span>交易管理</span>
        </div>
        <div class="beader-left-two" @click="toubiao()">
          <span>我的投标</span>
        </div>
        <div class="beader-left-four" @click="fabu()">
          <span>我的发布</span>
        </div>
      </div>
      <!-- 我的投标 -->
      <div class="beader-release" v-show="Mybid">
        <div class="beader-release-top">
          <span>我的投标</span>
        </div>
        <div class="beader-release-center">
          <div
            class="beader-release-kuai"
            v-for="(w, index) in wdtb"
            :key="index"
            @click="ytb(index)"
          >
            <div class="beader-release-kuai-img">
              <img :src="w.img" alt="" />
            </div>
            <div class="beader-release-kuai-size">
              <div>{{ w.name }}</div>
              <div v-if="index == 0">{{ yitoubiao.length }}</div>
              <div v-else-if="index == 1">{{ daiqianyue.length }}</div>
              <div v-else-if="index == 2">{{ zhixingzhong.length }}</div>
              <div v-else-if="index == 3">{{ failed.length }}</div>
              <div v-else-if="index == 4">{{ completeds.length }}</div>
              <div v-else>{{ w.number }}</div>
            </div>
          </div>
        </div>
      </div>
      <!-- 已投标  我的投标-->
      <div class="beader-bid" v-show="bid_tendered">
        <div class="beader-bid-top">
          <span>我的投标</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in yitoubiao"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == 0">选标中</td>
              <td>
                <span @click="isdelete('0', index, y.pid, y.isdelete)"
                  >删除</span
                >
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 待签约  我的投标-->
      <div class="beader-bid" v-show="bid_signed">
        <div class="beader-bid-top">
          <span>我的投标</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in daiqianyue"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == 1">待签约</td>
              <td>
                <span @click="isdelete('1', index, y.pid, y.isdelete)"
                  >删除</span
                >
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 执行中  我的投标-->
      <div class="beader-bid" v-show="bid_implement">
        <div class="beader-bid-top">
          <span>我的投标</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in zhixingzhong"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == 2">执行中</td>
              <td>
                <span @click="isdelete('2', index, y.pid, y.isdelete)"
                  >删除</span
                >
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 验收未通过  我的投标-->
      <div class="beader-bid" v-show="bid_failed">
        <div class="beader-bid-top">
          <span>我的投标</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in failed"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == 4">未通过</td>
              <td>
                <span @click="isdelete('3', index, y.pid, y.isdelete)"
                  >删除</span
                >
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 已完成  我的投标-->
      <div class="beader-bid" v-show="bid_completeds">
        <div class="beader-bid-top">
          <span>我的投标</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in completeds"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == 5">已完成</td>
              <td>
                <span @click="isdelete('4', index, y.pid, y.isdelete)"
                  >删除</span
                >
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 我的发布 -->
      <div class="beader-release" v-show="Myrelease">
        <div class="beader-release-top">
          <span>我的发布</span>
        </div>
        <div class="beader-release-center">
          <div
            class="beader-release-kuai"
            v-for="(w, index) in wdfb"
            :key="index"
            @click="xbz(index)"
          >
            <div class="beader-release-kuai-img">
              <img :src="w.img" alt="" />
            </div>
            <div class="beader-release-kuai-size">
              <div>{{ w.name }}</div>
              <div v-if="index == 0">{{ yitoubiao.length }}</div>
              <div v-else-if="index == 1">{{ daiqianyue.length }}</div>
              <div v-else-if="index == 2">{{ zhixingzhong.length }}</div>
              <div v-else-if="index == 3">{{ daiyanshou.length }}</div>
              <div v-else>{{ w.number }}</div>
            </div>
          </div>
        </div>
      </div>
      <!-- 选标中  我的发布-->
      <div class="beader-bid" v-show="rel_bid">
        <div class="beader-bid-top">
          <span>我的发布</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in yitoubiao"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == '0'">选标中</td>
              <td v-else-if="y.mark == '1'">待签约</td>
              <td>
                <span
                  v-if="y.mark == '0'"
                  class="beader-bid-table-span"
                  @click="wdfbxb(index, y.pid)"
                  >选标</span
                >
                <span v-else></span>
                <span
                  class="beader-bid-table-span"
                  @click="isdelete('0', index, y.pid, y.isdelete)"
                  >删除</span
                >
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 待签约 我的发布-->
      <div class="beader-bid" v-show="to_be_signed">
        <div class="beader-bid-top">
          <span>我的发布</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in daiqianyue"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == '1'">待签约</td>
              <td v-else-if="y.mark == '2'">执行中</td>
              <td>
                <span
                  class="beader-bid-table-span"
                  @click="isdelete('1', index, y.pid, y.isdelete)"
                  >删除</span
                >
                <el-dropdown v-if="y.mark == '1'">
                  <span class="el-dropdown-link"> 修改状态 </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item
                      @click.native="updatas(u.id, y.pid, index)"
                      v-for="(u, keys) in updatastate"
                      :key="keys"
                      >{{ u.name }}</el-dropdown-item
                    >
                  </el-dropdown-menu>
                </el-dropdown>
                <span v-else></span>
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 执行中 我的发布-->
      <div class="beader-bid" v-show="under_implementation">
        <div class="beader-bid-top">
          <span>我的发布</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in zhixingzhong"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == '2'">执行中</td>
              <td v-else-if="y.mark == '3'">待验收</td>
              <td>
                <span
                  class="beader-bid-table-span"
                  @click="isdelete('2', index, y.pid, y.isdelete)"
                  >删除</span
                >
                <el-dropdown v-if="y.mark == '2'">
                  <span class="el-dropdown-link"> 修改状态 </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item
                      @click.native="updataimplement(u.id, y.pid, index)"
                      v-for="(u, keys) in updatastates"
                      :key="keys"
                      >{{ u.name }}</el-dropdown-item
                    >
                  </el-dropdown-menu>
                </el-dropdown>
                <span v-else></span>
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- 待验收 我的发布-->
      <div class="beader-bid" v-show="to_be_accepted">
        <div class="beader-bid-top">
          <span>我的发布</span>
        </div>
        <table class="beader-bid-table">
          <div class="beader-bid-table-one">
            <tr>
              <td>标名</td>
              <td>
                <el-dropdown>
                  <span class="el-dropdown-link">
                    截止时间<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>2021-05-07</el-dropdown-item>
                    <el-dropdown-item>2021-05-08</el-dropdown-item>
                    <el-dropdown-item>2021-05-09</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </td>
              <td>状态</td>
              <td>操作</td>
            </tr>
          </div>
          <div
            class="beader-bid-table-two"
            v-for="(y, index) in daiyanshou"
            :key="index"
          >
            <tr>
              <td>{{ y.title }}</td>
              <td>{{ y.times }}</td>
              <td v-if="y.mark == '3'">待验收</td>
              <td v-else-if="y.mark == '4'">未通过</td>
              <td v-else-if="y.mark == '5'">已完成</td>
              <td>
                <span
                  class="beader-bid-table-span"
                  @click="isdelete('3', index, y.pid, y.isdelete)"
                  >删除</span
                >
                <el-dropdown v-if="y.mark == '3'">
                  <span class="el-dropdown-link"> 修改状态 </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item
                      @click.native="updataaccepted(u.id, y.pid, index)"
                      v-for="(u, keys) in updatastatetg"
                      :key="keys"
                      >{{ u.name }}</el-dropdown-item
                    >
                  </el-dropdown-menu>
                </el-dropdown>
                <span v-else></span>
              </td>
            </tr>
          </div>
        </table>
      </div>
      <!-- @close当弹出框消失时执行 -->
      <el-dialog
        title="选标"
        :visible.sync="dialogVisible"
        width="45%"
        class="dialog"
        @close="close"
      >
        <button v-for="(b, index) in button" :key="index" @click="xuanbiao(b)">
          {{ b }}
        </button>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="quedingxb()">确 定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fileShow: false,
      chakan: false, //附件查看隐藏
      innerVisibled: false, //附件查看
      poss: "******", //账户设置修改
      ruleForm: [], // 账户设置修改
      dialogFormVisibles: false, //账户设置详情显示
      input: "", //账户设置密码
      dialogFormVisible: false, //账户设置
      name: "", //姓名为空
      phone: "", //手机号为空
      sign: [], //本地保存的用户名
      outerVisible: false, //发布需求关闭
      innerVisible: false, //发布取消
      o_img: require("@/assets/img/fabuxuqiu.png"),
      company: "", //用户登录的公司名称
      removes: 0, //确定删除 我的投标，我的发布
      bid_completeds: false, //已完成隐藏 我的投标
      bid_failed: false, //验收未通过隐藏 我的投标
      bid_implement: false, //执行中隐藏 我的投标
      bid_signed: false, //待签约隐藏 我的投标
      completeds: [], //已完成 我的投标
      failed: [], //验收未通过 我的投标
      to_be_accepted: false, //待验收隐藏 我的发布
      daiyanshou: [], //待验收 我的发布
      under_implementation: false, //执行中隐藏
      zhixingzhong: [], //执行中 我的发布
      to_be_signed: false, //待签约隐藏
      daiqianyue: [], //待签约 我的发布
      yitoubiao: [], //已投标 我的投标
      bid_tendered: false, //我的投标--已投标 隐藏
      rel_bid: false, //我的发布--选标中 隐藏
      Mybid: true, //我的投标显示
      Myrelease: false, //我的发布隐藏
      xbid: "", //我的发布 -- 选标中 -- 选标表单下标
      xbpid: "", //我的发布 -- 选标中 -- 选标表单ID
      xuanbiaoqd: "", //我的发布 -- 选标中 -- 选标内容
      dialogVisible: false, //选标弹框关闭
      updatastate: [
        //执行中
        { id: "2", name: "执行中" },
      ],
      updatastates: [
        //待验收
        { id: "3", name: "待验收" },
      ],
      updatastatetg: [
        //未通过--已完成
        { id: "4", name: "未通过" },
        { id: "5", name: "已完成" },
      ],
      w_img: require("@/assets/img/logo-new.795fa9b6.png"),
      w_img_one: require("@/assets/img/gongzuotai-shouye.png"),
      w_img_two: require("@/assets/img/gongzoutaitouxiang.png"),
      popover: [
        {
          id: "0",
          img: require("@/assets/img/gongzuotai-shezhi.png"),
          name: "账户设置",
        },
        {
          id: "1",
          img: require("@/assets/img/gongzuotai-tuichu.png"),
          name: "退出登录",
        },
      ],
      button: [
        //选标数据
        "阿里云",
        "新商云",
        "临沂大智",
        "腾讯",
        "阿里巴巴",
        "字节跳动",
        "华为",
        "小米",
      ],
      b_img: require("@/assets/img/gongzuotai-jiaoyiguanli.png"),
      wdfb: [
        //我的发布
        {
          id: "1",
          img: require("@/assets/img/gongzuotai-xuanbiao.png"),
          name: "选标中",
          number: "0",
        },
        {
          id: "2",
          img: require("@/assets/img/gongzuotai-quanyue.png"),
          name: "待签约",
          number: "0",
        },
        {
          id: "3",
          img: require("@/assets/img/gongzuotai-zhixing.png"),
          name: "执行中",
          number: "0",
        },
        {
          id: "4",
          img: require("@/assets/img/gongzuotai-zhixing.png"),
          name: "待验收",
          number: "0",
        },
      ],
      wdtb: [
        //我的投标
        {
          id: "1",
          img: require("@/assets/img/gongzuotai-zhixing.png"),
          name: "已投标",
          number: "0",
        },
        {
          id: "2",
          img: require("@/assets/img/gongzuotai-quanyue.png"),
          name: "待签约",
          number: "0",
        },
        {
          id: "3",
          img: require("@/assets/img/gongzuotai-zhixing.png"),
          name: "执行中",
          number: "0",
        },
        {
          id: "4",
          img: require("@/assets/img/gongzuotai-yanshous.png"),
          name: "验收未通过",
          number: "0",
        },
        {
          id: "5",
          img: require("@/assets/img/gongzuotai-zhixing.png"),
          name: "已完成",
          number: "0",
        },
      ],
    };
  },
  created() {
    //用户手机号
    this.sign = JSON.parse(localStorage.getItem("logo"));
    //账号设置获取值
    this.http
      .type("/index", {
        type: "setup",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((res) => {
        this.ruleForm = res.data;
      });
    //类目选择
    this.http.type("/index", { type: "lmxz" }).then((response) => {
      this.rjdzkf = response.data;
    });
    //发布需求中用户姓名和手机号的默认提示
  },
  mounted() {
    //用户公司名称
    this.http
      .type("/index", {
        type: "company",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((res) => {
        this.company = res.data.company;
      });
    // 选标中
    this.http
      .type("/index", {
        type: "gzt",
        work: "bid",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((response) => {
        this.yitoubiao = response.data;
      });
    // 待签约
    this.http
      .type("/index", {
        type: "gzt",
        work: "sign",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((response) => {
        this.daiqianyue = response.data;
      });
    // 执行中
    this.http
      .type("/index", {
        type: "gzt",
        work: "implements",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((response) => {
        this.zhixingzhong = response.data;
      });
    // 待验收
    this.http
      .type("/index", {
        type: "gzt",
        work: "accepteds",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((response) => {
        this.daiyanshou = response.data;
      });
    //验收未通过
    this.http
      .type("/index", {
        type: "gzt",
        work: "failed",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((response) => {
        this.failed = response.data;
      });
    //验收已完成
    this.http
      .type("/index", {
        type: "gzt",
        work: "completeds",
        phone: JSON.parse(localStorage.getItem("logo")),
      })
      .then((response) => {
        this.completeds = response.data;
      });
  },
  methods: {
    closed() {
      //取消设置时重置
      this.http
        .type("/index", {
          type: "setup",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.ruleForm = res.data;
          this.poss = "******";
        });
    },
    baocun() {
      //账号设置，修改用户信息
      if (this.poss != "******") {
        this.ruleForm.poss = this.$md5(this.poss);
        this.$confirm("您的新密码是：" + this.poss + " ,是否继续?", "保存", {
          confirmButtonText: "保存",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.http
              .type("/index", {
                type: "setupInsert",
                ruleForm: JSON.stringify(this.ruleForm),
              })
              .then((res) => {
                if (res.data.code == 1) {
                  this.$message({
                    type: "success",
                    message: res.data.msg,
                  });
                  this.dialogFormVisibles = false;
                } else {
                  this.$message(res.data.msg);
                }
              });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消！",
            });
          });
      } else {
        this.http
          .type("/index", {
            type: "setupInsert",
            ruleForm: JSON.stringify(this.ruleForm),
          })
          .then((res) => {
            if (res.data.code == 1) {
              this.$message({
                type: "success",
                message: res.data.msg,
              });
              this.dialogFormVisibles = false;
            } else {
              this.$message(res.data.msg);
            }
          });
      }
    },
    zhanghu(run) {
      //点击账户设置
      if (run == 0) {
        if (JSON.parse(localStorage.getItem("password")) != null) {
          this.dialogFormVisibles = true;
        } else {
          this.dialogFormVisible = true;
        }
      }
    },
    jinru() {
      //进入账户设置
      if (this.input != "") {
        this.http
          .type("/index", {
            type: "password",
            poss: this.input,
            phone: JSON.parse(localStorage.getItem("logo")),
          })
          .then((res) => {
            if (res.data.code == 1) {
              this.$message({
                message: res.data.msg,
                type: "success",
              });
              localStorage.setItem(
                "password",
                JSON.stringify(this.$md5(this.input))
              );
              this.dialogFormVisible = false; //让输入密码隐藏
              this.dialogFormVisibles = true; //让账户设置显示
              this.input = "";
            } else {
              this.input = "";
              this.$message.error(res.data.msg);
            }
          });
      } else {
        this.$message({
          showClose: true,
          message: "密码不能为空！",
          type: "warning",
        });
      }
    },

    pop(index) {
      //退出登录和账户设置
      if (index == 1) {
        this.$confirm("此操作将退出该账户, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.$router.push("/");
            localStorage.removeItem("logo");
            localStorage.removeItem("password");
            this.$message({
              message: "退出成功",
              type: "success",
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消退出",
            });
          });
      }
    },
    close() {
      this.xbid = "";
      this.xuanbiaoqd = "";
    },
    // 删除
    isdelete(pid, index, id, isdelete) {
      this.$confirm("此操作将永久删除该投标, 是否继续?", "删除", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          if (this.removes == 0) {
            if (pid == 0) {
              this.yitoubiao.splice(index, 1); //已投标
            }
            if (pid == 1) {
              this.daiqianyue.splice(index, 1); //待签约
            }
            if (pid == 2) {
              this.zhixingzhong.splice(index, 1); //执行中
            }
            if (pid == 3) {
              this.failed.splice(index, 1); //未通过
            }
            if (pid == 4) {
              this.completeds.splice(index, 1); //已完成
            }
          }
          if (this.removes == 1) {
            if (pid == 0) {
              this.yitoubiao.splice(index, 1); //已投标
            }
            if (pid == 1) {
              this.daiqianyue.splice(index, 1); //待签约
            }
            if (pid == 2) {
              this.zhixingzhong.splice(index, 1); //执行中
            }
            if (pid == 3) {
              this.daiyanshou.splice(index, 1); //未通过
            }
          }
          this.http
            .type("/index", {
              type: "gzt",
              work: "remove",
              id: id,
              isdelete: isdelete,
            })
            .then((res) => {
              if (res.data.code == 1) {
                this.$message({
                  message: res.data.msg,
                  type: "success",
                });
              } else {
                this.$message({
                  message: res.data.msg,
                  type: "warning",
                });
              }
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //待验收--修改状态->已完成||未通过
    updataaccepted(mark, id, index) {
      let marks = mark == 4 ? "未通过" : "已完成";
      this.$confirm("此操作将选标 " + marks + ",是否继续?", "修改状态", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.daiyanshou[index].mark = mark;
          this.http
            .type("/index", {
              type: "gzt",
              work: "completed",
              id: id,
              mark: mark,
            })
            .then((res) => {
              if (res.data.code == 1) {
                this.$message({
                  message: res.data.msg,
                  type: "success",
                });
              } else {
                this.$message({
                  message: res.data.msg,
                  type: "warning",
                });
              }
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //执行中--修改状态->待验收
    updataimplement(mark, id, index) {
      this.$confirm("此操作将选标 待验收, 是否继续?", "修改状态", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.zhixingzhong[index].mark = mark;
          this.http
            .type("/index", {
              type: "gzt",
              work: "accepted",
              id: id,
              mark: mark,
            })
            .then((res) => {
              if (res.data.code == 1) {
                this.$message({
                  message: res.data.msg,
                  type: "success",
                });
              } else {
                this.$message({
                  message: res.data.msg,
                  type: "warning",
                });
              }
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    //待签约--修改状态->执行中
    updatas(mark, id, index) {
      this.$confirm("此操作将选标 执行中, 是否继续?", "修改状态", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.daiqianyue[index].mark = mark;
          this.http
            .type("/index", {
              type: "gzt",
              work: "implement",
              id: id,
              mark: mark,
            })
            .then((res) => {
              if (res.data.code == 1) {
                this.$message({
                  message: res.data.msg,
                  type: "success",
                });
              } else {
                this.$message({
                  message: res.data.msg,
                  type: "warning",
                });
              }
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    ytb(index) {
      this.Mybid = false;
      //我的投标--分类
      if (index == 0) {
        this.bid_tendered = true;
      }
      if (index == 1) {
        this.bid_signed = true;
      }
      if (index == 2) {
        this.bid_implement = true;
      }
      if (index == 3) {
        this.bid_failed = true;
      }
      if (index == 4) {
        this.bid_completeds = true;
      }
    },
    xbz(index) {
      //我的发布--分类
      if (index == 0) {
        //选标中 -- 我的发布
        this.Myrelease = false;
        this.rel_bid = true;
      }
      if (index == 1) {
        this.Myrelease = false;
        this.to_be_signed = true;
      }
      if (index == 2) {
        this.Myrelease = false;
        this.under_implementation = true;
      }
      if (index == 3) {
        this.Myrelease = false;
        this.to_be_accepted = true;
      }
    },
    wdfbxb(id, pid) {
      //我的发布 -- 选标中 -- 选标
      this.xbid = id;
      this.dialogVisible = true;
      this.xbpid = pid;
      console.log(this.xbpid);
    },
    xuanbiao(b) {
      this.xuanbiaoqd = b;
    },
    quedingxb() {
      //选标
      if (this.xuanbiaoqd != "") {
        this.dialogVisible = false;
        this.yitoubiao[this.xbid].mark = 1;
        this.yitoubiao[this.xbid].choose = this.xuanbiaoqd;
        this.http
          .type("/index", {
            type: "gzt",
            work: "Bidselection",
            id: this.xbpid,
            choose: this.xuanbiaoqd,
            mark: "1",
          })
          .then((res) => {
            if (res.data.code == 1) {
              this.$message({
                message: res.data.msg,
                type: "success",
              });
            } else {
              this.$message({
                message: res.data.msg,
                type: "warning",
              });
            }
          });
      } else {
        this.$message({
          message: "请先选标，再确定哦！",
          type: "warning",
        });
      }
    },
    toubiao() {
      //我的投标
      this.removes = 0;
      this.Mybid = true;
      this.Myrelease = false;
      this.rel_bid = false;
      this.bid_tendered = false;
      this.to_be_signed = false;
      this.under_implementation = false;
      this.to_be_accepted = false;
      this.bid_signed = false;
      this.bid_implement = false;
      this.bid_failed = false;
      this.bid_completeds = false;
      // 选标中
      this.http
        .type("/index", {
          type: "gzt",
          work: "bid",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.yitoubiao = res.data;
        }),
        // 待签约
        this.http
          .type("/index", {
            type: "gzt",
            work: "sign",
            phone: JSON.parse(localStorage.getItem("logo")),
          })
          .then((res) => {
            this.daiqianyue = res.data;
          }),
        // 执行中
        this.http
          .type("/index", {
            type: "gzt",
            work: "implements",
            phone: JSON.parse(localStorage.getItem("logo")),
          })
          .then((res) => {
            this.zhixingzhong = res.data;
          }),
        // 待验收
        this.http
          .type("/index", {
            type: "gzt",
            work: "accepteds",
            phone: JSON.parse(localStorage.getItem("logo")),
          })
          .then((res) => {
            this.daiyanshou = res.data;
          }),
        //验收未通过
        this.http
          .type("/index", {
            type: "gzt",
            work: "failed",
            phone: JSON.parse(localStorage.getItem("logo")),
          })
          .then((res) => {
            this.failed = res.data;
          }),
        //验收已完成
        this.http
          .type("/index", {
            type: "gzt",
            work: "completeds",
            phone: JSON.parse(localStorage.getItem("logo")),
          })
          .then((res) => {
            this.completeds = res.data;
          });
    },
    fabu() {
      //我的发布
      this.removes = 1;
      this.Mybid = false;
      this.Myrelease = true;
      this.rel_bid = false;
      this.bid_tendered = false;
      this.to_be_signed = false;
      this.under_implementation = false;
      this.to_be_accepted = false;
      this.bid_signed = false;
      this.bid_implement = false;
      this.bid_failed = false;
      this.bid_completeds = false;
      // 选标中
      this.http
        .type("/index", {
          type: "gzt",
          work: "bid",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.yitoubiao = res.data;
        });
      // 待签约
      this.http
        .type("/index", {
          type: "gzt",
          work: "sign",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.daiqianyue = res.data;
        });
      // 执行中
      this.http
        .type("/index", {
          type: "gzt",
          work: "implements",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.zhixingzhong = res.data;
        });
      // 待验收
      this.http
        .type("/index", {
          type: "gzt",
          work: "accepteds",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.daiyanshou = res.data;
        });
      //验收未通过
      this.http
        .type("/index", {
          type: "gzt",
          work: "failed",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.failed = res.data;
        });
      //验收已完成
      this.http
        .type("/index", {
          type: "gzt",
          work: "completeds",
          phone: JSON.parse(localStorage.getItem("logo")),
        })
        .then((res) => {
          this.completeds = res.data;
        });
    },
  },
};
</script>
<style lang="less" scoped>
.workbench {
  width: 100%;
  height: auto;
  background-color: #f5f6f8;
}
</style>
<style src="../src/workbench.css" scoped></style>